/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.proyectos.model;

import java.math.BigDecimal;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Jose
 */
@Entity
@Table(name = "cursos")
@NamedQueries({
    @NamedQuery(name = "Cursos.findByNombre", query = "SELECT c FROM Cursos c WHERE upper(c.cnombre) like :cnombre and c.ncarrera = :ncarrera "),
    @NamedQuery(name = "Cursos.findAll", query = "SELECT c FROM Cursos c where c.ncarrera = :ncarrera")})
public class Cursos {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column
    private BigDecimal ncodigo;
    @Column
    private String cnombre;
    @ManyToOne
    @JoinColumn(name = "ncarrera")
    private Carreras ncarrera;
    @Column 
    private String activo;

    public String getActivo() {
        return activo;
    }

    public void setActivo(String activo) {
        this.activo = activo;
    }


    
    
    

    public BigDecimal getNcodigo() {
        return ncodigo;
    }

    public void setNcodigo(BigDecimal ncodigo) {
        this.ncodigo = ncodigo;
    }

    public String getCnombre() {
        return cnombre;
    }

    public void setCnombre(String cnombre) {
        this.cnombre = cnombre;
    }

    public Carreras getNcarrera() {
        return ncarrera;
    }

    public void setNcarrera(Carreras ncarrera) {
        this.ncarrera = ncarrera;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 97 * hash + Objects.hashCode(this.cnombre);
        hash = 97 * hash + Objects.hashCode(this.ncarrera);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Cursos other = (Cursos) obj;
        if (!Objects.equals(this.cnombre, other.cnombre)) {
            return false;
        }
        if (!Objects.equals(this.ncarrera, other.ncarrera)) {
            return false;
        }
        return true;
    }
    

}
